class CardScoresController < ApplicationController

  before_filter :clear_game

  # GET /card_scores
  # GET /card_scores.xml
  def index
    @card_scores = CardScore.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @card_scores }
    end
  end

  # GET /card_scores/1
  # GET /card_scores/1.xml
  def show
    @card_score = CardScore.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @card_score }
    end
  end

  # GET /card_scores/new
  # GET /card_scores/new.xml
  def new
    @card_score = CardScore.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @card_score }
    end
  end

  # GET /card_scores/1/edit
  def edit
    @card_score = CardScore.find(params[:id])
  end

  # POST /card_scores
  # POST /card_scores.xml
  def create
    @card_score = CardScore.new(params[:card_score])

    respond_to do |format|
      if @card_score.save
        flash[:notice] = 'CardScore was successfully created.'
        format.html { redirect_to(@card_score) }
        format.xml  { render :xml => @card_score, :status => :created, :location => @card_score }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @card_score.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /card_scores/1
  # PUT /card_scores/1.xml
  def update
    @card_score = CardScore.find(params[:id])

    respond_to do |format|
      if @card_score.update_attributes(params[:card_score])
        flash[:notice] = 'CardScore was successfully updated.'
        format.html { redirect_to(@card_score) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @card_score.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /card_scores/1
  # DELETE /card_scores/1.xml
  def destroy
    @card_score = CardScore.find(params[:id])
    @card_score.destroy

    respond_to do |format|
      format.html { redirect_to(card_scores_url) }
      format.xml  { head :ok }
    end
  end
end
